1. /* scfatanh.cpp by K.Tsuru */
  2. // function ID = 9120 since ver 2.18
  3. /*****************************************
  4. SComplex class
  5. It returns artanh(z).
  6. Catanh(z) = Clog{(1+z)/(1-z)}/2
  7. = (1/i)arctan(iz). ver 2.21
  8. When z = x(pure real),let atanh(x) = p,
  9. -1 < x = tanh(p) < 1 must be satisfied.
  10. *****************************************/
  11. #ifndef SN_H
  12. #include "sn.h"
  13. #endif
  14. #if 0
  15. SComplex Catanh(const SComplex& z) {
  16. if(Im(z) == 0.0) { // z = x
  17. if( Dabs(Re(z)) >= 1.0) z.Real().SetError(z.Real().DOMAIN_ERR, "Catanh(z) with z = x(|x| > 1.0))", 9120);
  18. }
  19. SComplex y = (ONE + z)/(ONE - z);
  20. return CsDiv(Clog(y), 2);
  21. }
  22. #else /********************************/
  23. SComplex Catanh(const SComplex& z) {
  24. if(Im(z) == 0.0) {
  25. if( Dabs(Re(z)) >= 1.0) z.Real().SetError(z.Real().DOMAIN_ERR, "Catanh(z) with z = x(|x| > 1.0))", 9120);
  26. }
  27. return MI*Catan(IU*z); // (1/i)arctan(iz)
  28. }
  29. #endif

scfatanh.cpp : last modifiled at 2016/08/25 16:39:08(918 bytes)
created at 2017/10/06 15:21:28
The creation time of this html file is 2017/10/06 15:27:08 (Fri Oct 06 15:27:08 2017).